<%@ page language="java" import="java.util.*" import="java.sql.*" import="java.math.BigDecimal" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="entity.Connect,entity.Goods"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>

<table border="1">
	<tr>
   		<th>ID</th>
		<th>NAME</th>
		<th>PRICE</th>
		<th>NUMBER</th>
		<th>操作</th>
	</tr>

  	<tr>
	<%int count = Integer.parseInt(request.getParameter("count"));%>
	<%BigDecimal price = new BigDecimal(request.getParameter("price"));
	price=price.setScale(2, BigDecimal.ROUND_HALF_UP);%>
	<%String name = request.getParameter("name");%>
	<td><%=new Random().nextInt(100) %></td>
    <td><%=name %></td>
    <td><%=price %></td>
    <td><%-- <%=count %> --%></td>
	<td align="center"> <a href="#" onclick="this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode)">删除</a> </td>
  </tr>
  <%
	List<Goods> list=new Connect().getAllgoods();
	for(Goods e:list){ %>
	<tr>
	<td><%=e.getId() %></td>
	<td><%=e.getName() %></td>
	<td><%=e.getPrice() %></td>
	<td><%=e.getNum() %></td>
	<td align="center"> <a href="#" onclick="this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode)">删除</a> </td>
	</tr>
	<%} %>
</table>
<input type="button" value="返回继续购物" onclick="window.location.href='Goods.jsp'"/>
</body>
</html>